#include <iostream>
#include <set>
using namespace std;
typedef pair<int, string> mypair;
struct ltmypair {
 	 					bool operator()(const mypair& p1, const mypair& p2) const
  							{
    						   return ((p1.first < p2.first) || ((p1.first == p2.first) && (p1.second < p2.second)));
  						}
};



int main(){
	set<mypair,ltmypair> myset;
	pair< set<mypair,ltmypair>::iterator,bool> ret;
	ret=myset.insert(mypair(1,"Rong Xiao"));
	ret=myset.insert(mypair(1,"Rong Xiao Jr."));
	ret=myset.insert(mypair(2,"Rong Xiao"));
	ret=myset.insert(mypair(1,"Rong Xiao"));

	cout << myset.size() << endl; 
	set<mypair,ltmypair>::const_iterator fnd=myset.find(mypair(1,"Rong Xiao Jr."));
	cout << (fnd==myset.end()) <<endl;
	// iterator find ( const key_type& x ) const;
	cout << (*fnd).second << endl;
	myset.erase(fnd);
	ret=myset.insert(mypair(1,"Rong Xiao Jr."));
	ret=myset.insert(mypair(0,"Rong Xiao Sr."));
	cout << ret.second << endl;
	for(fnd=myset.begin();fnd != myset.end();fnd++)
			cout << (*fnd).first <<" " << (*fnd).second << endl;

	return 0;
}
